# Setting the prefix from `C-b` to `C-a`.
# By remapping the `CapsLock` key to `Ctrl`,
# you can make triggering commands more comfottable!
set -g prefix C-a

# Free the original `Ctrl-b` prefix keybinding.
unbind C-b

# Ensure that we can send `Ctrl-a` to other apps.
bind C-a send-prefix

# Reload the file with Prefix r.
bind r source-file ~/.tmux.conf \; display "Reloaded!"

# Splitting panes.
bind | split-window -h
bind - split-window -v

# Moving between panes.
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# Moveing between windows.
# Provided you've mapped your `CAPS LOCK` key to the `CTRL` key,
# you can now move between panes without moving your hands off the home row.
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+

# Pane resizing.
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5

# Maximize and restore a pane.
unbind Up
bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp

# Log output to a text file on demand.
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"

# Vimlike copy mode.
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection

# Setting the delay between prefix and command.
set -sg escape-time 1

# Set the base index for windows to 1 instead of 0.
set -g base-index 1

# Set the base index for panes to 1 instead of 0.
setw -g pane-base-index 1

# Mouse support - set to on if you want to use the mouse.
setw -g mode-mouse off
set -g mouse-select-pane off
set -g mouse-resize-pane off
set -g mouse-select-window off

# Set the default terminal mode to 256color mode.
set -g default-terminal "screen-256color"

# Enable activity alerts.
setw -g monitor-activity on
set -g visual-activity on

# Pane colors.
set -g pane-border-fg green
set -g pane-border-bg black
set -g pane-active-border-fg white
set -g pane-active-border-bg yellow

# Command / message line.
set -g message-fg white
set -g message-bg black
set -g message-attr bright

# Enable vi keys.
 setw -g mode-keys vi

# statusbar --------------------------------------------------------------

set -g display-time 2000

# default statusbar colors
set -g status-fg colour8
set -g status-bg colour100
set -g status-attr dim

# default window title colors
set-window-option -g window-status-fg colour58
set-window-option -g window-status-bg black
set-window-option -g window-status-attr default

# active window title colors
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-bg colour13
set-window-option -g window-status-current-attr bright

# command/message line colors
set -g message-fg colour58
set -g message-bg colour8
set -g message-attr bright

# center align the window list
# set -g status-justify centre

# show some useful stats but only when tmux is started 
# outside of Xorg, otherwise dwm statusbar shows these already
set -g status-left "┋┊#[fg=colour8] ₪ #H ┋#[default]"
set -g status-right "┊#[fg=colour8]#(cat /proc/loadavg | cut -d \" \" -f 1,2,3)#[default] ┆ #[fg=colour8,bright]%a %Y-%m-%d %H:%M #[default]┋"
set -g status-right-length 50



